home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Extra 1996 #3 / AmigaPlus_CD-ROM-EXTRA_Nr.3.bin / aminet-spiele / role on / labyrinthii / labyrinth_ii.c < prev    next >
C/C++ Source or Header  |  1988-10-02  |  16KB  |  828 lines

  1.  
  2. /* Linking instructions for Aztec C:
  3.  * ln labyrinth_ii.o mod2.o messages.o ps.o ss.o readfile.o input.o console.o
  4.  *    talk.o c.lib */
  5.  
  6. #define MODE_OLDFILE 1005L    /* System define, easier than using the whole
  7.                              * include file */
  8. #define BOYS 24        /* Number of boys in game */
  9. #define GIRLS 24    /* (sex distinction so program can print right pronoun) */
  10. #define STUDENTS BOYS+GIRLS
  11. #define MEN 18
  12. #define WOMEN 4
  13. #define TEACHERS MEN+WOMEN
  14. #define PLAYERS STUDENTS+TEACHERS
  15. #define OBJECTS 44
  16. #define VERBS 38
  17. #define FAWEAPON 7    /* First offensive weapon */
  18. #define FDWEAPON 2    /* First defensive weapon */
  19. #define FTREASURE 31    /* First valuable object */
  20. #define AWEAPONS 24    /* Number of offensive weapons */
  21. #define DWEAPONS 5    /* Number of defensive weapons */
  22. #define TREASURES 14    /* Number of valuable objects */
  23. #define ROOMS 217
  24. #define NAMELEN 30L        /* Max length of user-defined name */
  25. #define INLEN 60L        /* Max length of input */
  26. #define DESCLEN 40000L     /* Amount of memory space for location descriptions */
  27. #define NOWHERE -9999    /* If something is NOWHERE, it no longer exists */
  28. #define MAXCARR 10        /* Maximum number of objects that can be carried */
  29. #define DROPZONE 75        /* Where treasures must be dropped to score points */
  30.  
  31. long OpenLibrary (),Open (),Read (),RangeRand (),start (),checkinput (),input ();
  32. int lockable (),walk (),numobj ();
  33. char *AllocMem ();
  34.  
  35. #define rnd(x) RangeRand((long)x)
  36. #define MAX(a,b) ((a)>(b)?(a):(b))
  37. #define MIN(a,b) ((a)<(b)?(a):(b))
  38.  
  39. typedef char flag;    /* For a very small range of possible values */
  40.  
  41. char *directions[]=
  42. {
  43.     "North.\n",
  44.     "South.\n",
  45.     "East.\n",
  46.     "West.\n",
  47.     "Northeast.\n",
  48.     "Northwest.\n",
  49.     "Southeast.\n",
  50.     "Southwest.\n",
  51.     "Up.\n",
  52.     "Down.\n"
  53. };
  54.  
  55. char *oname[]=
  56. {
  57.     "",                /* Null is for object 0 (they start at 1) */
  58.     "set of keys",
  59.                     /* Defensive weapons */
  60.     "riot shield",
  61.     "dustbin lid",
  62.     "bulletproof vest",
  63.     "crash helmet",
  64.     "suit of armour",
  65.                     /* Offensive weapons in order of effectiveness */
  66.     "whip",
  67.     "knuckleduster",
  68.     "cudgel",
  69.     "truncheon",
  70.     "electric drill",
  71.     "baton",
  72.     "broken bottle",
  73.     "stick",
  74.     "sawn-off pool cue",
  75.     "poker",
  76.     "hatchet",
  77.     "bicycle chain",
  78.     "crowbar",
  79.     "knife",
  80.     "club",
  81.     "quarterstaff",
  82.     "dagger",
  83.     "axe",
  84.     "rapier",
  85.     "chainsaw",
  86.     "scimitar",
  87.     "sword",
  88.     "mace",
  89.     "lightsaber",
  90.                     /* Valuable objects */
  91.     "diamond ring",
  92.     "silver cup",
  93.     "ten-pound note",
  94.     "Amiga A500",
  95.     "68882 floating-point coprocessor chip",
  96.     "mink coat",
  97.     "gold nugget",
  98.     "Compaq Portable 386",
  99.     "pocket calculator",
  100.     "Van Gogh painting",
  101.     "digital watch",
  102.     "gold watch",
  103.     "T800 transputer",
  104.     "airline ticket"
  105. };
  106.  
  107. char *verb[]=
  108. {
  109.     "",
  110.     "shut",
  111.     "open",
  112.     "close",
  113.     "n",
  114.     "s",
  115.     "e",
  116.     "w",
  117.     "ne",
  118.     "nw",
  119.     "se",
  120.     "sw",
  121.     "u",
  122.     "d",
  123.     "attack",
  124.     "hit",
  125.     "kill",
  126.     "get",
  127.     "take",
  128.     "drop",
  129.     "wait",
  130.     "spectator",
  131.     "quit",
  132.  
  133.     "look",
  134.     "inventory",
  135.     "who",
  136.     "information",
  137.     "become",
  138.     "local",
  139.     "global",
  140.     "brief",
  141.     "normal",
  142.     "verbose",
  143.     "tame",
  144.     "gruesome",
  145.     "exits",
  146.     "talk",
  147.     "quiet",
  148.     "help"
  149. };
  150.  
  151. char *pname[]=
  152. {
  153.     "nobody",
  154.     "Russell Wallace",
  155.     "Bob Gray",
  156.     "Shane Broadberry",
  157.     "Alan Callender",
  158.     "Allen Dunne",
  159.     "Tara Morris",
  160.     "Ian O'Keeffe",
  161.     "Garrett Simons",
  162.     "Nigel Waterhouse",
  163.     "Daragh Fitzpatrick",
  164.     "Naoise Hart",
  165.     "Julian Carr",
  166.     "Shayan Sen",
  167.     "Paul Whelan",
  168.     "David Watchorn",
  169.     "Richard Middleton",
  170.     "Jason O'Brien",
  171.     "Jason Gull",
  172.     "Paul Rimas",
  173.     "Edmund Farrell",
  174.     "Eddy Carroll",
  175.     "Marcus McInnes",
  176.     "Norman Ruddock",
  177.     "Rory Miller",
  178.  
  179.     "Coralie Burns",
  180.     "Susan Carroll",
  181.     "Ruth Laycock",
  182.     "Ruth Whittaker",
  183.     "Gillian Nother",
  184.     "Sarah Gilliland",
  185.     "Penny Jackson",
  186.     "Lucy Jones",
  187.     "Emma Kelly",
  188.     "Antoinette Uhlar",
  189.     "Suzanne Donegan",
  190.     "Marina Fleeton",
  191.     "Ciara O'Mahony",
  192.     "Swapna Rao",
  193.     "Fiona McDowell",
  194.     "Fiona Reeves",
  195.     "Naomi Varian",
  196.     "Hilary Usher",
  197.     "Lynnea Fitzgerald",
  198.     "Alison Whitty",
  199.     "Tara O'Rourke",
  200.     "Lynne Beamish",
  201.     "Sarah Lessen",
  202.     "Antoinette Harbourne",
  203.  
  204.     "Mr. Reeves",
  205.     "Mr. Tilson",
  206.     "Mr. Godsil",
  207.     "Mr. Spencer",
  208.     "Mr. Agnew",
  209.     "Mr. Stiobhard",
  210.     "Mr. Allen",
  211.     "Mr. Wilson",
  212.     "Dr. Frewin",
  213.     "Mr. McArdle",
  214.     "Mr. Hosford",
  215.     "Mr. Bradbury",
  216.     "Mr. Duke",
  217.     "Mr. Keegan",
  218.     "Mr. Boyd",
  219.     "Mr. Hamill",
  220.     "Mr. Beere",
  221.     "Mr. Viale",
  222.  
  223.     "Ms. Parsons",
  224.     "Ms. Symns",
  225.     "Ms. Lee",
  226.     "Ms. Murphy"
  227. };
  228.  
  229. int defval[]=    /* Defensive value of objects */
  230. {
  231.     10,6,9,5,8
  232. };
  233.  
  234. int attval[]=    /* Offensive value */
  235. {
  236.     46,48,61,62,62,63,65,65,66,66,67,68,69,69,70,
  237.     77,78,101,104,114,139,141,156,200
  238. };
  239.  
  240. int value[]=
  241. {
  242.     130,157,10,700,450,190,623,6999,19,2400,12,80,250,232
  243. };
  244.  
  245. int ownroom[]=
  246. {
  247.     59,60,63,33,29,70,65,64,44,43,42,30,3,32,20,56,66,16,21,68,1,14
  248. };
  249.  
  250. flag talking;        /* Speech on or off */
  251. flag violence;        /* Tame or gruesome */
  252. flag descriptions;    /* 0 for brief to 2 for verbose */
  253. flag narration;        /* 0/1 ... local/global */
  254. int player;            /* Who is the player? */
  255.  
  256. int score[PLAYERS+1];    /* +1 is because we're not using element 0 */
  257. int strength[PLAYERS+1];
  258. int power[PLAYERS+1];
  259. int ploc[PLAYERS+1];    /* Location of player */
  260. int pcouldbe[PLAYERS+1];    /* For deciding which is one named in input */
  261.  
  262. int oloc[OBJECTS+1];    /* Location of object */
  263. int ocouldbe[OBJECTS+1];
  264.  
  265. int exits[ROOMS+1][10];    /* Exits from rooms */
  266. int oexits[ROOMS+1][10];    /* Original exits from rooms */
  267. flag visited[ROOMS+1];    /* Which rooms have been visited */
  268.  
  269. int Verb,Noun;            /* Verb,noun input by player */
  270. int oldverb,oldnoun;    /* Previous verb, noun */
  271. int gameover;            /* Is game over? */
  272. long waiting;            /* How many turns still to wait? */
  273. long filehandle;        /* Handle for room description file */
  274. char namebuf[NAMELEN];    /* buffer for user-defined name */
  275. char inbuf[INLEN];        /* buffer for input */
  276. char *descs;            /* Location of room description file in memory */
  277. char *shortdesc[ROOMS+1],*longdesc[ROOMS+1];    /* Location of descriptions */
  278.  
  279. main ()
  280. {
  281.     int i;
  282.     int sparescore=0;
  283.     setup ();    /* Once-off initialization of global variables etc. */
  284.     print ("Welcome to Labyrinth II by Russell Wallace. Do you want instructions? (Press Y or N):");
  285.     if (yesno ())
  286.     {
  287.         if (readfile ("Labyrinth_II.instructions.doc"))
  288.             print ("Sorry, couldn't get the instructions file.\n");
  289.         print ("\nPress any key to continue.\n");
  290.         do
  291.             i=checkinput ();
  292.         while (i==0);
  293.         if (i==1000)
  294.         {
  295.             finish ();
  296.             FreeMem (descs,DESCLEN);
  297.             exit (0);
  298.         }
  299.     }
  300. REPEATGAME:
  301.     initialize ();    /* Initialize individual game */
  302.     score[player]=sparescore;
  303. REPEATINPUT:
  304.     if (waiting==0)    /* If we're not waiting at the moment, get input */
  305.     {
  306. MISTAKE:
  307.         getinput ();    /* Get player command */
  308.         if (Verb==0)
  309.         {
  310.             print ("Sorry, I don't understand you.\n");
  311.             goto MISTAKE;
  312.         }
  313.         oldverb=Verb;
  314.         oldnoun=Noun;
  315.         if (doinput ())    /* Act on command ... if nonzero, mistake-repeat */
  316.             goto MISTAKE;
  317.     }
  318.         else
  319.         {
  320.             waiting--;    /* If waiting, now one less turn to wait */
  321.             i=(short)checkinput ();
  322.             if (i==1000)            /* If closewindow, finish */
  323.             {
  324.                 FreeMem (descs,DESCLEN);
  325.                 finish ();
  326.                 exit (0);
  327.             }
  328.             if (i)                    /* If keypress, stop waiting */
  329.                 waiting=0;
  330.         }
  331.     if (gameover)
  332.         goto ENDOFGAME;
  333.     if (Verb>21)            /* If verb doesn't take any game time */
  334.         goto REPEATINPUT;    /* then get next input immediately */
  335.     for (i=1;i<=PLAYERS;i++)
  336.     {
  337.         if (i!=player && ploc[i]!=NOWHERE)
  338.             domobile (i);    /* Do computer-controlled characters */
  339.         if (waiting>1000000)    /* If spectator mode, don't have any */
  340.             resetscroll ();        /* pauses in narration */
  341.     }
  342.     if (gameover)
  343.         goto ENDOFGAME;
  344.     gameover=1;
  345.     for (i=1;i<=PLAYERS;i++)    /* Game over if everyone else dead */
  346.     {
  347.         if (i!=player && ploc[i]!=NOWHERE)
  348.             gameover=0;
  349.         strength[i]+=7;
  350.         if (strength[i]>power[i])
  351.             strength[i]=power[i];
  352.     }
  353.     if (!gameover)
  354.         goto REPEATINPUT;
  355.     print ("\nCongratulations! You've outlasted all the other players!\n");
  356.     sparescore=score[player];
  357.     goto WON;
  358. ENDOFGAME:
  359.     sparescore=0;
  360. WON:
  361.     print ("\nGame over.");
  362.     if (player)        /* If player was actually one of the characters */
  363.     {
  364.         print (" Your score was ");
  365.         printshort (score[player]);
  366.         print (". Your power was ");
  367.         printshort (power[player]);
  368.         writechar ((long)'.');
  369.     }
  370.     print (" Would you like to play again?");
  371.     if (yesno ())
  372.         goto REPEATGAME;
  373.     FreeMem (descs,DESCLEN);
  374.     finish ();    /* Close window etc. */
  375. }
  376.  
  377. int yesno ()    /* Get yes or no input */
  378. {
  379.     int i;
  380. YNLOOP:
  381.     i=checkinput ();
  382.     if (i==1000)
  383.     {
  384.         FreeMem (descs,DESCLEN);
  385.         finish ();
  386.         exit (0);
  387.     }
  388.     if (i=='y' || i=='Y')
  389.     {
  390.         print (" YES\n");
  391.         return (1);
  392.     }
  393.     if (i=='n' || i=='N')
  394.     {
  395.         print (" NO\n");
  396.         return (0);
  397.     }
  398.     goto YNLOOP;
  399. }
  400.  
  401. setup ()
  402. {
  403.     int i,j,k;
  404.     char *z,dirbuf[2];
  405.     long Seconds,Micros;
  406.     if (!(descs=AllocMem (DESCLEN,0L)))
  407.     {
  408.         DisplayBeep (0L);
  409.         exit (1);
  410.     }
  411.     if (!(start ()))    /* Open text window */
  412.     {
  413.         FreeMem (descs,DESCLEN);
  414.         DisplayBeep (0L);
  415.         exit (2);
  416.     }
  417.     if (!(filehandle=Open ("Labyrinth_II.descriptions.doc",MODE_OLDFILE)))
  418.     {
  419.         FreeMem (descs,DESCLEN);
  420.         finish ();
  421.         DisplayBeep (0L);
  422.         exit (3);
  423.     }
  424.     (void)Read (filehandle,descs,DESCLEN);    /* Read room descs from file */
  425.     Close (filehandle);                        /* then close file */
  426.     z=descs;
  427.     for (;;)    /* Scan through whole text file in memory */
  428.     {
  429.         for (;*z!='{' && *z!='~';z++)
  430.             ;
  431.         if (*z=='~')
  432.             break;            /* ~ marks end of file */
  433.         i=scanshort (++z);
  434.         for (;*z!='[';z++)
  435.             ;
  436.         shortdesc[i]=++z;    /* Assign short description for room to */
  437.         for (;*z!='[';z++)    /* appropriate place in file */
  438.             ;
  439.         *(z-1)='\0';        /* Put zero terminator at end of description */
  440.         longdesc[i]=++z;    /* in place of closing bracket */
  441.         for (;*z!='[';z++)
  442.             ;
  443.         *(z-1)='\0';
  444.         z++;
  445.         for (;;)    /* Scan through exit list */
  446.         {
  447.             dirbuf[0]=tolower (*z++);
  448.             dirbuf[1]=tolower (*z++);
  449.             if (*z==' ')
  450.                 z++;
  451.                     else
  452.                         dirbuf[1]='\0';
  453.             k=scanshort (z);
  454.             for (j=4;j<=13;j++)
  455.                 if (dirbuf[0]==verb[j][0] && dirbuf[1]==verb[j][1])
  456.                     oexits[i][j-4]=k;
  457.             for (;*z!=' ' && *z!=']';z++)
  458.                 ;
  459.             if (*z==']')
  460.                 break;    /* ] marks end of exit list */
  461.             z++;
  462.         }
  463.     }
  464.     talking=0;
  465.     violence=0;
  466.     descriptions=1;
  467.     narration=0;
  468.     player=1;
  469.     oldverb=0;
  470.     for (i=0;i<=ROOMS;i++)
  471.         visited[i]=0;    /* No rooms visited yet */
  472.     CurrentTime (&Seconds,&Micros);
  473.     for (i=0;i<(Micros&1023);i++)    /* Seed random number generator */
  474.         (void)rnd (Seconds|1);
  475.     print ("Enter name you want to use (default is Russell Wallace): ");
  476.     if (input (namebuf,NAMELEN)==-1000)
  477.     {
  478.         finish ();
  479.         FreeMem (descs,DESCLEN);
  480.         exit (0);
  481.     }
  482.     if (namebuf[0]!='\0')        /* If name has been typed, assign it */
  483.         pname[1]=namebuf;
  484. }
  485.  
  486. initialize ()
  487. {
  488.     int i,j;
  489.     gameover=0;
  490.     waiting=0;
  491.     resetscroll ();
  492.     print ("\fGame now starting...\n\n");
  493.     for (i=1;i<=OBJECTS;i++)
  494.         oloc[i]=rnd (ROOMS)+1;
  495.     for (i=0;i<=PLAYERS;i++)    /* Setting things up for player 0 as well, */
  496.     {                            /* in case human player wants to use it */
  497.         strength[i]=300;
  498.         power[i]=300;
  499.         score[i]=0;
  500.         if (i<=STUDENTS)
  501.         {
  502.             do
  503.                 ploc[i]=rnd (ROOMS)+1;
  504.             while (lockable (ploc[i]));
  505.         }
  506.             else
  507.                 ploc[i]=ownroom[i-49];
  508.     }
  509.     look (ploc[player]);
  510.     for (i=1;i<=ROOMS;i++)
  511.     {
  512.         for (j=0;j<=9;j++)
  513.             exits[i][j]=oexits[i][j];
  514.     }
  515. }
  516.  
  517. getinput ()
  518. {
  519.     register unsigned int z;
  520.     int i,j,k,closeness;
  521.     Verb=Noun=0;
  522.     writechar ((long)'>');
  523.     if (input (inbuf,INLEN)==-1000)
  524.     {
  525.         FreeMem (descs,DESCLEN);
  526.         finish ();
  527.         exit (0);
  528.     }
  529.     if (inbuf[0]=='\0')        /* If nothing typed, copy stuff from previous */
  530.     {
  531.         Verb=oldverb;
  532.         Noun=oldnoun;
  533.     }
  534.     for (i=0;i<INLEN;i++)
  535.         inbuf[i]=tolower (inbuf[i]);
  536.     i=0;
  537.     while (inbuf[i]==' ')
  538.         i++;
  539.     if (inbuf[i]=='\0')
  540.         return;
  541.     closeness=999;
  542.     for (j=1;j<=VERBS;j++)
  543.     {
  544.         z=(unsigned int)wcomp (verb[j],inbuf+i);
  545.         if (z<closeness)
  546.         {
  547.             closeness=z;
  548.             Verb=j;
  549.         }
  550.     }
  551.     if (Verb==1)                /* Shut=close */
  552.         Verb=3;
  553.     if (Verb==14 || Verb==15)    /* Attack, hit=kill */
  554.         Verb=16;
  555.     if (Verb==17)                /* Get=take */
  556.         Verb=18;
  557.     if (inbuf[i]=='i' && (inbuf[i+1]==' ' || inbuf[i+1]=='\0'))
  558.         Verb=24;
  559.     while (inbuf[i]!=' ' && inbuf[i]!='\0')
  560.         i++;        /* Scan to gap between words */
  561.     if (inbuf[i]=='\0')
  562.         return;        /* If no next word, return */
  563.     while (inbuf[i]==' ')
  564.         i++;        /* Scan to beginning of next word */
  565.     if (Verb==20)    /* If "wait", return following number */
  566.     {
  567.         Noun=scanshort (inbuf+i);
  568.         return;
  569.     }
  570.     if (Verb!=16 && Verb!=18 && Verb!=19 && Verb!=27)
  571.         return;        /* If verb doesn't have object, return */
  572.     closeness=999;
  573.     if (Verb==18 || Verb==19)    /* Take and drop take things as objects */
  574.     {
  575.         for (j=1;j<=OBJECTS;j++)
  576.             ocouldbe[j]=10000;
  577.         for (;;)    /* Do for all remaining words in input */
  578.         {
  579.             for (j=1;j<=OBJECTS;j++)
  580.             {
  581.                 k=compare (oname[j],inbuf+i);
  582.                 if (k==-1 || ocouldbe[j]==0)
  583.                     ocouldbe[j]=0;
  584.                         else
  585.                             ocouldbe[j]-=k;
  586.             }
  587.             while (inbuf[i]!=' ' && inbuf[i]!='\0')
  588.                 i++;
  589.             if (inbuf[i]=='\0')
  590.                 break;
  591.             while (inbuf[i]==' ')
  592.                 i++;
  593.             if (inbuf[i]=='\0')
  594.                 break;
  595.         }
  596.         closeness=1;
  597.         for (j=1;j<=OBJECTS;j++)
  598.             if (ocouldbe[j]>closeness)
  599.                 Noun=j;
  600.     }
  601.         else    /* Kill and become take people as objects */
  602.         {
  603.             for (j=1;j<=PLAYERS;j++)
  604.                 pcouldbe[j]=10000;
  605.             for (;;)
  606.             {
  607.                 for (j=1;j<=PLAYERS;j++)
  608.                 {
  609.                     k=compare (pname[j],inbuf+i);
  610.                     if (k==-1 || pcouldbe[j]==0)
  611.                         pcouldbe[j]=0;
  612.                             else
  613.                                 pcouldbe[j]-=k;
  614.                 }
  615.                 while (inbuf[i]!=' ' && inbuf[i]!='\0')
  616.                     i++;
  617.                 if (inbuf[i]=='\0')
  618.                     break;
  619.                 while (inbuf[i]==' ')
  620.                     i++;
  621.                 if (inbuf[i]=='\0')
  622.                     break;
  623.             }
  624.             closeness=1;
  625.             for (j=1;j<=PLAYERS;j++)
  626.                 if (pcouldbe[j]>closeness)
  627.                     Noun=j;
  628.         }
  629.     return;
  630. }
  631.  
  632. int wcomp (a,b)
  633. char *a,*b;
  634. {
  635.     int i;
  636.     do
  637.     {
  638.         if (*b==' ' || *b=='\0')
  639.         {
  640.             for (i=0;a[i]!=' ' && a[i]!='\0';i++)
  641.                 ;
  642.             return (i);
  643.         }
  644.         if (*a==' ' || *a=='\0')
  645.             return (-1);
  646.     }
  647.     while (tolower (*a++)==*b++);
  648.     return (-1);
  649. }
  650.  
  651. int compare (a,b)
  652. char *a,*b;
  653. {
  654.     unsigned int i,closest;
  655.     i=0;
  656.     closest=-1;
  657.     for (;;)
  658.     {
  659.         closest=MIN (closest,(unsigned int)wcomp (a+i,b));
  660.         while (a[i]!=' ' && a[i]!='\0')
  661.             i++;
  662.         if (a[i]=='\0')
  663.             break;
  664.         while (a[i]==' ')
  665.             i++;
  666.     }
  667.     return (closest);
  668. }
  669.  
  670. int lockable (r)
  671. int r;
  672. {
  673.     int i;
  674.     for (i=0;i<=9;i++)
  675.         if (oexits[r][i]>0)        /* If unlockable exit from room exists */
  676.             return (0);            /* then room is not lockable */
  677.     return (1);            /* otherwise it is */
  678. }
  679.  
  680. int numobj (r)        /* Returns number of objects in room r */
  681. int r;
  682. {
  683.     int i,j;
  684.     j=0;
  685.     for (i=1;i<=OBJECTS;i++)
  686.         if (oloc[i]==r)
  687.             j++;
  688.     return (j);
  689. }
  690.  
  691. oprint (o,cap)
  692. int o,cap;
  693. {
  694.     int i;
  695.     char c,*a;
  696.     a=inbuf+1;
  697.     if (cap)
  698.         inbuf[0]='A';
  699.             else
  700.                 inbuf[0]='a';
  701.     c=tolower (oname[o][0]);
  702.     if (c=='a' || c=='e' || c=='i' || c=='o' || c=='u')
  703.         *a++='n';
  704.     *a++=' ';
  705.     for (i=0;oname[o][i]!='\0';i++)
  706.         *a++=oname[o][i];
  707.     *a++='\0';
  708.     print (inbuf);
  709. }
  710.  
  711. olist (r)
  712. int r;
  713. {
  714.     int i,k;
  715.     flag j=0;
  716.     for (i=1;i<=OBJECTS;i++)
  717.         if (oloc[i]==r)
  718.         {
  719.             if (j)
  720.             {
  721.                 writechar ((long)',');
  722.                 writechar ((long)' ');
  723.             }
  724.             oprint (i,0);
  725.             j=1;
  726.         }
  727.     print (".\n");
  728. }
  729.  
  730. look (r)
  731. int r;
  732. {
  733.     int i;
  734.     print (shortdesc[r]);
  735.     writechar ((long)'\n');
  736.     if (((!visited[r]) && descriptions)|| descriptions==2)
  737.     {
  738.         print (longdesc[r]);
  739.         writechar ((long)'\n');
  740.     }
  741.     visited[r]=1;
  742.     if (numobj (r))
  743.     {
  744.         print ("You can also see ");
  745.         olist (r);
  746.     }
  747.     for (i=1;i<=PLAYERS;i++)
  748.         if (ploc[i]==r && i!=player)
  749.         {
  750.             print (pname[i]);
  751.             print (" is here.\n");
  752.             perdesc (i);
  753.         }
  754. }
  755.  
  756. perdesc (p)
  757. int p;
  758. {
  759.     if (p<=BOYS || (p>STUDENTS && p<=STUDENTS+MEN))
  760.         print ("His");
  761.             else
  762.                 print ("Her");
  763.     print (" strength is ");
  764.     printshort (strength[p]);
  765.     print (".\n");
  766.     if (numobj (-p))
  767.     {
  768.         if (p<=BOYS || (p>STUDENTS && p<=STUDENTS+MEN))
  769.             print ("He");
  770.                 else
  771.                     print ("She");
  772.         print (" is carrying ");
  773.         olist (-p);
  774.     }
  775. }
  776.  
  777. int walk (p,dir)
  778. int p,dir;
  779. {
  780.     if (exits[ploc[p]][dir]<0)
  781.         return (1);
  782.     if (exits[ploc[p]][dir]==0)
  783.         return (2);
  784.     ploc[p]=exits[ploc[p]][dir];
  785.     if (ploc[p]==ploc[player] && p!=player)
  786.     {
  787.         print (pname[p]);
  788.         print (" arrives.\n");
  789.         perdesc (p);
  790.         if (player)
  791.             waiting=0;
  792.     }
  793.     return (0);
  794. }
  795.  
  796. get (p,o)
  797. int p,o;
  798. {
  799.     oloc[o]=-p;
  800.     if (ploc[p]==ploc[player])
  801.     {
  802.         print (pname[p]);
  803.         print (" takes the ");
  804.         print (oname[o]);
  805.         print (".\n");
  806.     }
  807. }
  808.  
  809. drop (p,o)
  810. int p,o;
  811. {
  812.     oloc[o]=ploc[p];
  813.     if (ploc[p]==ploc[player])
  814.     {
  815.         print (pname[p]);
  816.         print (" drops ");
  817.         oprint (o,0);
  818.         print (".\n");
  819.     }
  820.     if (ploc[p]==DROPZONE && o>=FTREASURE && o<FTREASURE+TREASURES)
  821.     {
  822.         score[p]+=value[o-FTREASURE];
  823.         oloc[o]=NOWHERE;
  824.         if (ploc[p]==ploc[player])
  825.             print ("It vanishes in a swirl of light.\n");
  826.     }
  827. }
  828.